$(function(){
	var c=0;
	var a=0;
	function run(){
		c++;
		c=(c==2)?0:c;
		$('#top_main .pic img').eq(c).stop().fadeIn(300).siblings('img').stop().fadeOut(300);
		$('#top_main .pic ul li').eq(c).css({'background':'white'}).siblings('li').css({'background':'#666'});
	}
	timer = setInterval(run,3000);
	$('#top_main .pic ul li').hover(function(){
		var _this = $(this);
		t = setTimeout(function(){
			c = _this.index();
		    $('#top_main .pic img').eq(c).stop().fadeIn(300).siblings('img').stop().fadeOut(300);
		    $('#top_main .pic ul li').eq(c).css({'background':'white'}).siblings('li').css({'background':'#666'});
		},200)	
	},function(){
		clearTimeout(t);
	})
	$('#top_main .pic ').hover(function(){
		$('#top_main .go').css({'display':'block'});
		$('#top_main .back').css({'display':'block'});
		clearInterval(timer);
	},function(){
		$('#top_main .go').css({'display':'none'});
		$('#top_main .back').css({'display':'none'});
		timer = setInterval(run,3000)
	})
	$('#top_main .go ').click(function(){	
		if(a==1){
			return;
		}
		a=1;
		c++;
		c=(c==2)?0:c;
		$('#top_main .pic img').eq(c).stop().fadeIn(300,function(){a=0;}).siblings('img').stop().fadeOut(300);
		$('#top_main .pic ul li').eq(c).css({'background':'white'}).siblings('li').css({'background':'#666'});
	})
	$('#top_main .back ').click(function(){	
		if(a==1){
			return;
		}
		a=1;
		c--;
		c=(c==-1)?1:c;
		$('#top_main .pic img').eq(c).stop().fadeIn(300,function(){a=0;}).siblings('img').stop().fadeOut(300);
		$('#top_main .pic ul li').eq(c).css({'background':'white'}).siblings('li').css({'background':'#666'});
	})
})
